# lintcode: (8) Rotate String
# Problem Statement

# Given a string and an offset, rotate string by offset. (rotate from left to

# right)

# Example

# Given "abcdefg".

# offset=0 => "abcdefg"
# offset=1 => "gabcdef"
# offset=2 => "fgabcde"
# offset=3 => "efgabcd"

def moveStr(s,offset):
	s1 = list(s)
	m = list(s)
	for e in range(0,len(s1)):
		s1[ (e + offset)%len(s)] = m[e]
	return s1

print(moveStr('abcdefg',2))

## 挑战O(1)空间复杂度